let Hwp = require("html-webpack-plugin")
let Ext = require("extract-text-webpack-plugin")
let Webpack = require('webpack');

module.exports = {
    entry: __dirname + "/src/main.js",
    output: {
        path: __dirname + "/dist/",
        filename: "app.js",
        publicPath: "/"
    },
    devtool: "source-map",
    devServer: {
        contentBase: __dirname + "/dist/",
        port: 3000,
        inline: true,
        historyApiFallback: true,
        disableHostCheck: true,
        publicPath: "/",
        proxy: {
            "/zhuiszhu": {
                target: "http://39.105.136.190:3000"
            }
        }
    },
    module: {
        rules: [
            { test: /\.css$/, loader: Ext.extract("css-loader") },
            { test: /\.less$/, loader: Ext.extract("css-loader!less-loader") },
            { test: /\.html$/, loader: "string-loader" },
            { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
            { test: /\.(png|jpg|gif)$/, use: [{ loader: 'url-loader', options: { limit: 8192 } }] }
        ]
    },
    plugins: [
        new Hwp({
            template: "index.html",
            filename: "index.html",
            inject: true
        }),
        new Ext("app.css"),
        new Webpack.ProvidePlugin({
            React: 'react'
        })
    ]
}